package com.promise.jokerdream.ui.settings

import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import com.promise.jokerdream.database.entity.OtherGameConfigEntity
import com.promise.jokerdream.ui.components.SettingCard
import com.promise.jokerdream.ui.components.CheckboxOptionRow
import com.promise.jokerdream.ui.theme.AppSpacing

/**
 * 其他设置卡片
 */
@Composable
fun OtherSettingCard(
    config: OtherGameConfigEntity,
    onOtherChange: (Boolean) -> Unit,
    onDreamTripChange: (Boolean) -> Unit,
    onPenguinTravelogueChange: (Boolean) -> Unit,
    onFactionChallengeChange: (Boolean) -> Unit,
    onScrollDungeonChange: (Boolean) -> Unit,
    onFactionAltarChange: (Boolean) -> Unit,
    onFactionMineChange: (Boolean) -> Unit,
    onPenguinRecallChange: (Boolean) -> Unit,
    onApprenticeExperienceChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    onExecuteClick: (() -> Unit)? = null
) {
    SettingCard(
        title = "其他",
        description = "其他任务设置",
        checked = config.enabledSetting,
        onCheckedChange = onOtherChange,
        modifier = modifier,
        onExecuteClick = onExecuteClick,
        content = {
            if (config.enabledSetting) {
                Column(
                    verticalArrangement = Arrangement.spacedBy(AppSpacing.componentSmall)
                ) {
                    // 梦幻之旅
                    CheckboxOptionRow(
                        title = "梦幻之旅",
                        checked = config.dreamTripEnabled,
                        onCheckedChange = onDreamTripChange
                    )

                    // 乐斗游记
                    CheckboxOptionRow(
                        title = "乐斗游记",
                        checked = config.penguinTravelogueEnabled,
                        onCheckedChange = onPenguinTravelogueChange
                    )

                    // 帮派踢馆
                    CheckboxOptionRow(
                        title = "帮派踢馆",
                        checked = config.factionChallengeEnabled,
                        onCheckedChange = onFactionChallengeChange
                    )

                    // 画卷迷踪
                    CheckboxOptionRow(
                        title = "画卷迷踪",
                        checked = config.scrollDungeonEnabled,
                        onCheckedChange = onScrollDungeonChange
                    )

                    // 帮派祭坛
                    CheckboxOptionRow(
                        title = "帮派祭坛",
                        checked = config.factionAltarEnabled,
                        onCheckedChange = onFactionAltarChange
                    )

                    // 矿洞
                    CheckboxOptionRow(
                        title = "矿洞",
                        checked = config.factionMineEnabled,
                        onCheckedChange = onFactionMineChange
                    )

                    // 豆油召回
                    CheckboxOptionRow(
                        title = "重出江湖",
                        checked = config.penguinRecallEnabled,
                        onCheckedChange = onPenguinRecallChange
                    )

                    // 徒弟经验
                    CheckboxOptionRow(
                        title = "徒弟经验",
                        checked = config.apprenticeExperienceEnabled,
                        onCheckedChange = onApprenticeExperienceChange
                    )
                }
            }
        }
    )
}
